<template>
  <div>
    <Header title="采购退货单管理"></Header>
    <div class="Order">
      <operate :isAddShow="isAddShow" :isSeniorShow="isSeniorShow"></operate>
      <table cellspacing="0">
        <tr>
          <th>采购退货单号</th>
          <th>供应商名称</th>
          <th>退货金额</th>
          <th>退货数量</th>
          <th>制单人</th>
          <th>制单日期</th>
          <th>审核状态</th>
          <th>入库状态</th>
          <th>操作</th>
        </tr>
        <tr v-for="item in returnorderList" :key="item.id" ref="del">
          <td v-for="(value, key) in item" :key="key">{{ value }}</td>
          <td>操作</td>
        </tr>
        <tr>
          <td colspan="9" style="border: 0; color: #000">
            <Footer></Footer>
          </td>
        </tr>
      </table>
    </div>
  </div>
</template>
<script>
import Header from "@/components/goods/header";
import Footer from "@/components/member/footer";
import operate from "@/components/goods/operate";
export default {
  data() {
    return {
      isAddShow: false,
      isSeniorShow: true,
      returnorderList: [],
      code: "",
    };
  },
  filters: {},
  beforeDestroy() {},
  created() {
    this.renderTable();
  },
  components: {
    Footer,
    Header,
    operate,
  },
  methods: {
    renderTable(option) {
      let list = [];
      this.$http
        .post(
          "http://120.76.56.2:3001/purcase/returnOrders/getreturnorderInfo",
          option
        )
        .then((ret) => {
          this.$store.commit("common/setTotal", ret.count);
          this.$store.commit("common/setTotalPages", ret.pages);
          ret.data.forEach((item) => {
            list.push({
              returnOrder: item.returnOrder,
              supplier: item.supplier,
              returnMoney: item.returnMoney,
              purcaseRNum: item.purcaseRNum,
              personnel: item.personnel,
              makeDate: item.makeDate,
              checkState: item.checkState,
              putState: item.putState,
            });
          });
          this.returnorderList = list;
        });
    },
  },
  watch: {
    suppliercode: function (val) {
      if (val) {
        this.renderTable({ returnOrder: val });
      }
    },
    num: function (val) {
      if (val) {
        this.renderTable({ page: val });
      }
    },
  },
  computed: {
    suppliercode() {
      return this.$store.state.common.code;
    },
    num() {
      return this.$store.state.common.num;
    },
  },
};
</script>
<style lang="scss" scoped>
@import "@/assets/scss/table.scss";
span {
  color: blue;
  font-size: 12px;
  margin: 0 4px;
  cursor: pointer;
}
.del {
  color: blue;
  font-size: 12px;
  margin: 0 4px;
}
</style>
